Wallet is defined by the IWallet interface. There are currently 2 implementations of the IWallet interface in this SDK.
1. EOAWallet
EOAWallet is a standard EOA wallet for EVM chains.
An EOAWallet is easily created:
2. SequenceWalletToEOAWalletAdapter
SequenceWalletToEOAWalletAdapter is an adapter that allows you to use a SequenceWallet with the same IWallet interface as an EOAWallet so that it may be used interchangeably with EOA wallets throughout the rest of the SequenceEthereum library.
A SequenceWalletToEOAWalletAdapter is easily created once you have a SequenceWallet:
Methods
TheIWallet interface provides a number of methods for you. The most important of which are:
GetAddress
Returns theAddress for the wallet
SendTransaction
Signs the givenEthTransaction and submits it via the given client
SendTransactionAndWaitForReceipt
Signs the givenEthTransaction and submits it via the given client then waits for the TransactionReceipt
SendTransactionBatch
Signs the givenEthTransaction[] and submits them via the given client.
If wallet is an EOAWallet, the transactions will be submitted sequentially, each of which may pass or fail. If the wallet is a SequenceWalletToEOAWalletAdapter, the transactions will be batched together into a single transaction that is submitted all at once and either passes or fails as a whole.
Similarly, if a wallet is an EOAWallet the string[] (transaction hashes) you receive will be equal in length to the EthTransaction[] you submitted. While, if the wallet is a SequenceWalletToEOAWalletAdapter, you will only receive one transaction hash (string[] of length 1)
SendTransactionBatchAndWaitForReceipts
Signs the givenEthTransaction[] and submits them via the given client then waits for the TransactionReceipt[].
If wallet is an EOAWallet, the transactions will be submitted sequentially, each of which may pass or fail. If the wallet is a SequenceWalletToEOAWalletAdapter, the transactions will be batched together into a single transaction that is submitted all at once and either passes or fails as a whole.
Similarly, if a wallet is an EOAWallet the TransactionReceipt[] you receive will be equal in length to the EthTransaction[] you submitted. While, if the wallet is a SequenceWalletToEOAWalletAdapter, you will only receive one transaction receipt (TransactionReceipt[] of length 1)
SignMessage
Given a message and an optional chain id, sign the message using the wallet. Omit the chain id from the signature if not providedChain object (recommended), you can use the AsString method to get the hexadecimal format of the chain id